package com.heima.search.listener;

import com.alibaba.fastjson.JSON;
import com.heima.common.constants.ArticleConstants;
import com.heima.model.search.vos.SearchArticleVo;
import com.heima.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;

/**
 * 同步条侦听器
 *
 * @author DiXiaoNie
 * @date 2023/01/02
 * @since 2023/1/2 14:58
 */

public class SyncArticleListener {

    @Autowired
    private SearchService searchService;

    @KafkaListener(topics = ArticleConstants.ARTICLE_ES_SYNC_TOPIC)
    public void getMessage(String message) {
        SearchArticleVo searchArticleVo = JSON.parseObject(message, SearchArticleVo.class);

        //2.写入数据到es中
    }
}
